#include <bits/stdc++.h>
using namespace std;
bool sts;
int n, tot = 1, minh[25000006], nxt[25000006][2], ans = 0;
bool ed[25000006];
string s[1000006];
bool eds;
void push_up(int i) {
	if (ed[i]) {
		minh[i] = 2;
	} else if (!nxt[i][0] || !nxt[i][1]) minh[i] = 1;
	else minh[i] = min(minh[nxt[i][0]], minh[nxt[i][1]]) + 1;
}

void insert(const string &s, int it, int now) {
//	cout << s << " " << it << " " << now << "\n";
	if (it == s.size()) {
		if (!ed[now] && (!nxt[now][0] && !nxt[now][1])) {
		//	cout << "set " << now << " \n";
			ed[now] = 1;
			minh[now] = 2;
	//		cout << "ok\n";
			return;
		}
		if (ed[now]) {
			assert(nxt[now][0] == 0 && nxt[now][1] == 0);
			nxt[now][0] = ++tot;
			++ans;
		//	cout << "push_down " << now << "\n";
			insert("", 0, nxt[now][0]);
			ed[now] = 0;
			push_up(now);
		//	cout << "unset " << now << " \n";
		}
		++ans;
	//	cout << "put off\n";
		if (!nxt[now][0]) {
		//	cout << "get " << tot + 1 << " 0 \n";
			nxt[now][0] = ++tot;
		//	cout << "set " << tot << " \n";
			ed[tot] = 1;
			push_up(tot);
			push_up(now);
			return;
		}
		if (!nxt[now][1]) {
		//	cout << "get " << tot + 1 << " 1 \n";
			nxt[now][1] = ++tot;
		//	cout << "set " << tot << " \n";
			ed[tot] = 1;
			push_up(tot);
			push_up(now);
			return;
		}
		if (minh[nxt[now][0]] < minh[nxt[now][1]]) {
			insert(s, it, nxt[now][0]);
			push_up(now);
			return;
		} else {
			insert(s, it, nxt[now][1]);
			push_up(now);
			return;
		}
		assert(0);
		return;
	}
	int c = s[it] - '0';
	if (!nxt[now][c]) {
		nxt[now][c] = ++tot;
	}
	insert(s, it + 1, nxt[now][c]);
	push_up(now);
}

bool cmp(const string &a, const string &b) {
	return a.size() > b.size();
}

signed main() {
	freopen("id.in", "r", stdin); freopen("id.out", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> s[i];
	}
	sort(s + 1, s + n + 1, cmp);
	for (int i = 1; i <= n; ++i) {
		insert(s[i], 0, 1);
	}
	cout << ans << "\n"; 
}
